#!/bin/bash

# 复制构建的动态库到正确位置的脚本

echo "正在设置动态库文件..."

# 尝试从onnxruntime构建目录复制库文件
SOURCE_DIR="onnxruntime/build"
TARGET_DIR="."

if [ -f "$SOURCE_DIR/libfunasr_flutter.so" ]; then
    echo "复制 libfunasr_flutter.so 到当前目录"
    cp "$SOURCE_DIR/libfunasr_flutter.so" .
else
    echo "未找到 $SOURCE_DIR/libfunasr_flutter.so"
    echo "请确保已成功构建onnxruntime库"
fi

if [ -f "$SOURCE_DIR/libfunasr_flutter.dylib" ]; then
    echo "复制 libfunasr_flutter.dylib 到当前目录"
    cp "$SOURCE_DIR/libfunasr_flutter.dylib" .
else
    echo "未找到 $SOURCE_DIR/libfunasr_flutter.dylib"
fi

echo ""
echo "库文件设置完成。"
echo "如果仍有问题，请检查："
echo "1. 确保已成功构建onnxruntime库"
echo "2. 确保所有依赖库（如libonnxruntime.so, ffmpeg相关库）也已安装"
echo "3. 确保所有库文件架构匹配"